<?php 
/*
Plugin Name: Seta services
*/
class Seta_service_Widget extends WP_Widget{

  public function __construct() {
        parent::__construct(false,$name = __('Seta Sevices'));
  }
  public function widget( $args,$instanse ){

    if(isset($instanse['show_post_widget_title'])){
        $widget_title = $instanse['show_post_widget_title'];
    }

    if(isset($instanse['show_post_widget_cat_value'])){
        $cat_id = $instanse['show_post_widget_cat_value'];
    }

    if(isset($instanse['num_post'])){
        $num_post = $instanse['num_post'];
    }
?>
<!-- output html -->
<div id="services" class="region animated-area">
  <div class="container">
    <h2 class="title-big">Dịch vụ</h2>
    <div class="row">
      <div class="col-lg-5">
        <div class="animated" data-animation="fadeInLeft">
          <div class="media">
            <a class=" pull-left" href="javascript:void(0)">
              <img class="svg media-object" src="http://localhost/seta-asia/wp-content/themes/setatheme/images/basic_lightbulb.svg" alt="service-offshore-consulting" />
            </a>
            <div class="media-body">
              <h3 class="media-heading"><a href="javascript:void(0)">Offshore Consulting</a></h3>
              <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sit amet diam eu erat vehicula feugiat.</p>
            </div>
          </div>
        </div>
        <div class="animated" data-animation="fadeInLeft">
          <div class="media">
            <a class="pull-left" href="javascript:void(0)">
              <img class="svg media-object" src="http://localhost/seta-asia/wp-content/themes/setatheme/images/basic_accelerator.svg" alt="service-vn-offshore-dev" />
            </a>
            <div class="media-body">
              <h3 class="media-heading"><a href="javascript:void(0)">Vietnam Offshore Development</a></h3>
              <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sit amet diam eu erat vehicula feugiat.</p>
            </div>
          </div>
        </div>
      </div>
      <div class="col-lg-2">
      </div>
      <div class="col-lg-5">
        <div class="animated" data-animation="fadeInRight">
          <div class="media">
            <a class="pull-left" href="javascript:void(0)">
              <img class="svg media-object" src="http://localhost/seta-asia/wp-content/themes/setatheme/images/basic_key.svg" alt="service-web-solution" />
            </a>
            <div class="media-body">
              <h3 class="media-heading"><a href="javascript:void(0)">Web Solution</a></h3>
              <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sit amet diam eu erat vehicula feugiat.</p>
            </div>
          </div>
        </div>
        <div class="animated" data-animation="fadeInRight">
          <div class="media">
            <a class="pull-left" href="javascript:void(0)">
              <img class="svg media-object" src="http://localhost/seta-asia/wp-content/themes/setatheme/images/basic_server2.svg" alt="service-system-solution" />
            </a>
            <div class="media-body">
              <h3 class="media-heading"><a href="javascript:void(0)">System Solution</a></h3>
              <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sit amet diam eu erat vehicula feugiat.</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<?php 
  }
  public function form( $instanse ){

    $instance = wp_parse_args( (array) $instance, $defaults );

    if(isset($instanse['show_post_widget_cat_value'])){
        $show_post_widget_cat_value = $instanse['show_post_widget_cat_value'];
    }
    
    if(isset($instanse['show_post_widget_title'])){
        $show_post_widget_title = $instanse['show_post_widget_title'];
    }
    
    if(isset($instanse['num_post'])){
        $num_post = $instanse['num_post'];
    }
?>
<!-- Widget form -->
<p>Title:<input type="text" name="<?php echo $this->get_field_name('show_post_widget_title'); ?>" value="<?php echo $show_post_widget_title; ?> " /></p>
<?php    
  }
  public function update($new_instance,$old_instance){
    $instance = $old_instance;
      
    $instance['show_post_widget_cat_value'] = (!empty($new_instance['show_post_widget_cat_value'])) ? 
    strip_tags($new_instance['show_post_widget_cat_value']) : '';
    
    $instance['show_post_widget_title'] = (!empty($new_instance['show_post_widget_title'])) ? 
    strip_tags($new_instance['show_post_widget_title']) : '';
    
    $instance['num_post'] = (!empty($new_instance['num_post'])) ? 
    strip_tags($new_instance['num_post']) : '';
    
    return $instance;
  }
}
add_action('widgets_init',function(){register_widget('Seta_service_Widget');});